package com.yj.proxyPattern;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RemoteException;

import com.yj.WinnerStatePattern.GumballMachine;

public class GumballMachineTestDrive {
	
	public static void main(String[] args) {
		GumballMachineRemote gumballMachine=null;
		int count;
		if(args.length<2){
			System.out.println("GumballMachine <name> <inventory>");
			System.exit(1);
		}
		
		count=Integer.parseInt(args[1]);
		
		try {
			gumballMachine=new GumballMachine(args[0], count);
			Naming.rebind("//"+args[0]+"/gumballmachine", gumballMachine);
		} catch (RemoteException | MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
